home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Mail
/
pine3.92
/
pine
/
osdep
/
execview.wnt
< prev
next >
Wrap
Text File
|
1996-03-17
|
2KB
|
80 lines
#line 2 "osdep/execview.wnt"
/*----------------------------------------------------------------------
Routine to execute command mailcap says is used to display MIME segment
under MS-Windows win32 interface
The exported routine is:
exec_mailcap_cmd --
----*/
/* ----------------------------------------------------------------------
Execute the given
Args: cmd --
image_file --
----*/
void
exec_mailcap_cmd(cmd, image_file, needsterminal)
char *cmd;
char *image_file;
int needsterminal; /* not used in Windows */
{
STARTUPINFO start_info;
PROCESS_INFORMATION proc_info;
DWORD exit_code;
dprint(9, (debugfile, "run_viewer: command=%s\n", cmd)) ;
cancel_busy_alarm(1);
memset(&proc_info, 0, sizeof(proc_info));
memset(&start_info, 0, sizeof(start_info));
start_info.dwFlags = STARTF_FORCEONFEEDBACK;
start_info.wShowWindow = SW_SHOWNORMAL;
if(CreateProcess(NULL, cmd, NULL, NULL, FALSE,
CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP,
NULL, NULL, &start_info, &proc_info) == TRUE){
q_status_message(SM_ORDER, 0, 4, "VIEWER command completed");
dprint (3, (debugfile, "CreatProcess(%s) Success.\n", cmd));
/* Arrange to have the file deleted when the viewer exits. But
* if that fails, tell the user. */
if(mswin_ontask_del(proc_info.hProcess, image_file))
q_status_message1(SM_ORDER, 0, 4,
"Temp file %s created, but not deleted", image_file);
}
else{
int rc = (int) GetLastError();
unlink(image_file);
q_status_message2(SM_ORDER, 3, 4, "\007Can't start viewer. %s%s.",
(rc == 2 || rc == 3) ? "Viewer not found: " :
(rc == 8) ? "Not enough memory" : "Windows error ",
(rc == 2 || rc == 3) ? cmd :
(rc == 8) ? "" : int2string(rc));
}
}
/* ----------------------------------------------------------------------
Execute the given test= cmd
Args: cmd -- command to execute
Returns exit status
----*/
int
exec_mailcap_test_cmd(cmd)
char *cmd;
{
return((WinExec(cmd, SW_SHOWMINNOACTIVE) < 32) ? 1 : 0);
}